import i18n from "@/local/i18n";
import routes from "@/routes";
import {useAppSelector} from "@/store/store.ts";
import {ReactFlowProvider} from "@xyflow/react";
import {ThemeProvider} from 'antd-style';
import {BarChart, HeatmapChart, PieChart} from "echarts/charts";
import * as echarts from "echarts/core";
import {CanvasRenderer} from "echarts/renderers";
import {I18nextProvider} from "react-i18next";
import {RouterProvider} from "react-router-dom";
import styles from './App.module.less'


echarts.use(
    [BarChart, HeatmapChart, CanvasRenderer, PieChart]
);

function App() {
    const systemTheme = useAppSelector(state => state.system.theme)
    return (
        <div className={styles["app"]}>
            <I18nextProvider i18n={i18n}>
                <ThemeProvider appearance={systemTheme}>
                    <ReactFlowProvider>
                        <RouterProvider router={routes}/>
                    </ReactFlowProvider>
                </ThemeProvider>
            </I18nextProvider>

        </div>
    )
}

export default App
